names_list = ["白眉鹰王", "金毛狮王", "紫衫龙王", "金毛狮王", "青翼蝠王"]
find_name = "金毛狮王"

# 使用 list.index 完成查找
res_index = names_list.index(find_name)
print(f"res_index = {res_index}")


def seq_search(my_list, find_val):
    """
    顺序查找指定的元素
    :param my_list: 要查找的列表
    :param find_val: 要查找的值
    :return: 元素的索引
    """
    find_index = -1
    for index, val in enumerate(my_list):
        if find_val == val:
            find_index = index
            break
    else:
        print(f"没有找到对应的值：{find_val}")
    return find_index


res_index = seq_search(names_list, find_name)
print(f"res_index = {res_index}")


def seq_search2(my_list, find_val):
    find_index = []
    for index, val in enumerate(my_list):
        if find_val == val:
            find_index.append(index)
    else:
        print(f"没有找到对应的值：{find_val}")
    return find_index

res_index = seq_search2(names_list, find_name)
print(f"res_index = {res_index}")